package com.surfilter.risk.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.NumberFormat;

/**
 * ProportionUtil
 * Dis:
 * Created by jstarseven on 2017/5/12.
 */
public class ProportionUtil {
    private static Logger logger = LoggerFactory.getLogger(ProportionUtil.class);

    public static Integer getPropertion(Long numerator, Long denominator){
        NumberFormat numberFormat = NumberFormat.getInstance();
        // 设置精确到小数点后2位
        numberFormat.setMaximumFractionDigits(0);
        String result = numberFormat.format((float) numerator / (float) denominator * 100);
        return Integer.parseInt(result);
    }
}
